<?php
/**
 * 专题
 */
namespace App\Models;


class Activities extends BaseModel
{
    protected $table = 'activities';

    protected $casts = [
        'image' => 'json'
    ];

    public function setPicturesAttribute($pictures)
    {
        if (is_array($pictures)) {
            $this->attributes['image'] = json_encode($pictures);
        }
    }

    public function getPicturesAttribute($pictures)
    {
        return json_decode($pictures, true);
    }

//    public function images()
//    {
//        return $this->belongsToMany(Image::class, 'product_images');
//    }
}